Tree-Dialog Decision Tree Inference
Tree-Dialog is a special Tree-driven user interface mode available as an option from release 9.5 (JavaScript Engine Deployment only). In this mode, Questions encountered in tree path at runtime are automatically grouped on a single Dialog (as opposed to being captured by one dialog at a time). The size and content of the tree-driven Dialog is therefore dynamic and extends as the Tree-Dialog inference unfolds. The following Tree-Dialog Decision Tree Object will render the web page shown below at runtime.


Tree Dialog Design
The default Knowledge Module Template includes a pre-configured Base Class called "Tree_Dialog". "Tree_Dialog" Objects can be used to define a tree-driven Dialog (under the "Tree_Dialogs" Category). The following is how a Tree-Dialog Base Class or Object can be configured.
- The Tree-Dialog mode is activated by setting a Tree Object's selectionMode inference property to 'Tree Dialog'
- A Dialog Object must be tied to the (top-level) Tree-Dialog Object via its tiedDialog display property.
- In the default Knowledge Module Template, the Base Class "Tree_Dialog" is tied to the Dialog "Master_TD_Dlg"
- This Dialog Object is used for capturing all the Tree questions (including any back-chain Trees) until the end of Tree-Dialog inference.
- If tiedDialog is not set then a system default Dialog will be used at runtime.
- The Dialog must include a single TabSheet Control with its ControlType set to Panels. The area of the TabSheet expands vertically to capture more Attributes as the Tree-Dialog inference unfolds
- Any Dialog Control above the TabSheet Control remain in its fixed design-time coordinates
- Any Dialog Control below the TabSheet Control will be displayed below the last current panel (but retains its design-time horizontal coordinate (Left & Width property values)
- A Dialog Object must be tied to each Tree Question Object via the Question's tiedDialog display property.
- In the default Knowledge Module Template, the Base Classes "Tree_Dialog" is tied to the Dialog "Master_Tree_Dialog"
- In the default Knowledge Module Template, the following Base Classes each Question type have a Tied Dialog:
- Boolean_TD_Question (tied to Boolean_TD_Question_Dlg)
- List_TD_Question (tied to List_TD_Question_Dlg)
- Numeric_TD_Question (tied to Numeric_TD_Question_Dlg)
- Text_TD_Question (tied to Text_TD_Question_Dlg)
- Date_TD_Question (tied to Date_TD_Question_Dlg)
- These tied Dialogs are 'children' of (Master_TD_Question_Dlg)
- These tied Dialogs get embedded at runtime as Panels inside the (Master_TD_Dlg) Dialog for each Question encountered.
- Any Question captured by a Tree Dialog must not also be set using script commands that are invoked from within a Tree Dialog (directly or via a Procedure Object), this is because Tree Dialogs are scanned multiple times during Tree Dialog inference. In general you are advised to use caution when using commands from with Tree Dialogs.
Tree Dialog Inference
- The Dialog tied to the top Tree-Dialog extends automatically at runtime to prompt for the next Attribute in the Tree-Dialog inference. Consecutive "No-split" tree Attributes, and Attributes that already have values, will be shown in one go. (i.e. Tree-Dialog inference will only pause, if it encounters a split branch with a blank Attribute value).
- If the showOnTreeDialog property for an Attribute is set to False AND the Attribute already has a values (i.e. it's not blank), then it will not be shown during Tree-Dialog inference (this value will determine which tree branch to follow)
- Each Attribute prompted for during inference will embed its tied Dialog (set by its own tiedDialog property) as a panel on the main Dialog.
- The content of any Dialog directly embedded in the Tree will also be displayed in a panel when it is encountered during inference.
- Attributes in any Back-chained Tree Dialogs are shown on the same main Dialog
- If the runtime user changes the value of an earlier Attribute which leads down a different inference path, then any existing Attributes values that are not on the new path will be removed once the top-Dialog is exited.
- An Attribute that has already been captured on the main dialog is not re-displayed on the same dialog if encountered again.
- The OnCapture event of each Attribute is captured before it is displayed.
- If a Tree-Dialog is force-exited (using OnDialogExit) without answering all mandatory questions (allowBlank=False) then the Tree-Dialog Object value itself will be blank (isEmpty=True). Otherwise the Tree Leaf value reached will be assigned as normal.
- Where a Tree Sequence Node is used: For a single-select Tree Objects, the tree's inference will terminate when it reaches a Leaf that has a set value; For a multi-select Tree Objects, the tree's inference will continue to the last Tree node and the Tree Object will acquire all the (Leaf) values encountered.
- Tree-Dialog inference does not trigger the following inferences (unlike Dialog inference)
- OnUpdate events
- Constraint Inference
- Form Rules
Collapsing & Expanding Previously Answered Questions
As an alternative to vertically extending the top-Dialog to show all answered questions, the groupPreviousAnswers property of the top-level Tree-Dialog can be set to collapse answered questions and only show the last unanswered question. These answers questions can be expanded to see and change their value.
If the (groupPreviousAnswers) property of a Tree-Dialog Object is set to 'Above' or 'Below' then the panels of previously captured answers are 'collapsed' under a special 'Previous Answers' panel can be expanded by the user to see a summary (question's description property value & current value).

If the previousAnswersReadOnly=False then each previous answer panel can also be expanded to re-visit that question's embedded dialog to edit its existing value.
The "Previous Answers" caption can be set in Knowledge Module Settings tab.
Storing Captured Tree-Dialog Data
The @EncodeDataXML command can be invoked following Tree Dialog inference to encode all the values of all the Attributes that were captured during the Tree Dialog inference.
Note that if the runtime user re-answers an earlier Question which leads down a different inference path, then any answered Questions that are not on the new path will not be part of the encoded data.
The @EncodeDataXML command also encodes the value of the Tree-Dialog object itse (unlike standard decision inference). e.g. (Room_Details) in the following example:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<data>
<Room_Type>Bathroom</Room_Type>
<Legnth>11</Legnth>
<Width>6</Width>
<Height>3</Height>
</data>
Multi-Instance Tree Dialogs
This feature allows the runtime user to invoke the same "Tree Dialog" Object multiple times with the session automatically maintaining the captured data set for each instance separately.
This feature can be utilised by adding a SubDialog Control tiedDialog property is set to a "Tree Dialog" Object (or by drag & drop of the Tree Dialog from the Knowledge Explorer pane on to the Dialog editor). This SubDialog Control has special Add, Edit & Delete buttons.
When the Dialog is invoked at runtime the user can click the Add button to invoke the "Tree Dialog" Object. This can be repeated any number of times and all the Attribute values captured during each Add operation is retained as separate data instance, providing Multiple-instances of the data captured by the "Tree Dialog" Object. The Edit operation can be used to re-invoke any existing instance.
The SubDialog Control has the following relevant properties
- Columns: Should contain a comma delimited list of the names of Attribute(s), whose values are displayed at runtime as columns in the SubDialog Control (the Attribute's description property will be used as a column header)
- MaxInstances: The number of instances at which the Add button is disabled at runtime.
- MinIstances: The number of instances, below which the data is considered incomplete (for the purpose of Dialog exit) at runtime.
- AddBtnText: the text displayed at runtime for the Add button
- EditBtnText: the text displayed at runtime for the Edit button
- DeleteBtnText: the text displayed at runtime for the Delete button